package com.ssy.invoicing.invouser.service;

import java.sql.SQLException;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ssy.invoicing.dao.support.BaseSqlDao.SplitPageResult;
import com.ssy.invoicing.invouser.bean.InvoUser;
import com.ssy.invoicing.invouser.dao.InvoUserDao;

@Service(value="invoUserService")
@Transactional
public class InvoUserService {
    
    @Resource(name="invoUserDao")
    private InvoUserDao invoUserDao;
    
    public SplitPageResult queryUserListByPage(Integer page) throws SQLException {
        return invoUserDao.queryUserListByPage(null, page == null ? 1 : page.intValue());
    }

    /**
     * 根据用户名获得用户信息
     * @author suoyao.shen
     * @param name
     * @return
     */
    public InvoUser getInvoUserByName(String name) {
        return invoUserDao.getInvoUserByName(name);
    }
    
    /**
     * 根据用户Id获得用户信息
     * @author suoyao.shen
     * @param id
     * @return
     */
    public InvoUser getInvoUserById(Integer id) {
        return invoUserDao.getInvoUserById(id);
    }
    
    /**
     * @param user
     */
    public void saveUser(InvoUser user) {
        invoUserDao.saveUser(user);
    }
    
    /**
     * @param user
     */
    public void updateUser(InvoUser user) {
        invoUserDao.updateUser(user);
    }
    
    /**
     * @param id
     */
    public void removeUser(Integer id) {
        invoUserDao.removeUser(id);
    }
    
}
